#!/bin/sh

trap true INT TERM

tty="$1"
user="$2"
[ -z "$tty" -o -z "$user" ] && { echo "autologin: Invalid parameters"; exit 1; }

echo "/dev/$tty $user" >/tmp/autologin

/sbin/agetty --noclear -a "$user" "$tty" 38400

while true; do
	sleep 1
	/sbin/agetty "$tty" 38400
done
